define(
		[
		 	'jquery',
		 	'backbone',
	         'appvariables'
		 ], function($, Backbone, myapp) {
    var AppRouter = Backbone.Router.extend({
        routes : {
            ""			: "index"
        },
        initialize : function() {
        	if (myapp.init) {
        		return;
        	}
        	var clickMenu = function(link) {
        		require([link.split('#')[1]], function(app) {
        			$("#content").empty();
					app.initialize('#content');
	    		});
        	};
    		require(['api/topbarapi','api/leftmenuapi'], function(topbar, leftmenu) {
    			topbar.initialize("body");
    			leftmenu.initialize("#leftmenu", clickMenu);
    		});
    		myapp.init = true;
        },
        index :  function() {
        	
        }
    });
    var initialize  = function() {
    	myapp.appRouter = new AppRouter();
        Backbone.history.start();
    };
    return {
        initialize : initialize
    };
});